<?php
class score extends baseentity
{
    public function __construct($args=array())
    {
        parent::__construct($args);
        $this->addrelation( new belongto(array('user' => array('type'=>'user', 'column'=>'userid'))) );
    }

    protected $userid;
    protected $score;

    public function getfields()
    {
        return get_class_vars(__CLASS__);
    }

    public static function create(user $user, $score=0)
    {
       $score = new self; 
       $score->userid = $user->id;
       $score->score = $score;
    }

    public function addtobase($score=0)
    {
        $this->score += $score;
    }
}
